/**
 * ReportGear(2011)
 */
package com.reportgear.report.context;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import com.reportgear.report.model.cell.value.salary.SalaryObjectType;
import com.reportgear.report.view.JWorksheet;

/**
 * 报表上下文背景
 * 
 * @version 1.0 2011-3-24
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since report 1.0
 */
public enum ReportContext {
	INSTANCE;

	private Locale locale = null;
	private DefaultValues defaultValues = null;
	// 当前工作薄面板
	private JWorksheet currWorkSheet = null;

	// 发放表Id
	private int paymentId;
	// 对象分组层级
	private int groupLevel = 0;
	// 显示分层
	private List<Integer> showLevelList = new ArrayList<Integer>();
	// 使用选择的工资对象
	private boolean useSelectedObject;
	// 选择的工资对象Id
	private int selectedObjectId;
	// 薪酬对象类型(成本中心或组织机构)
	private SalaryObjectType salaryObjectType = SalaryObjectType.COSTCENTER;

	private ReportContext() {
		setLocale(Locale.CHINA);

		// 默认显示2,3层级
		showLevelList.add(2);
		showLevelList.add(3);

		groupLevel = 0;
	}

	public Locale getLocale() {
		return locale;
	}

	public void setLocale(Locale paramLocale) {
		if (paramLocale == null) {
			return;
		}
		locale = paramLocale;
	}

	public DefaultValues getDefaultValues() {
		if (defaultValues == null) {
			defaultValues = new DefaultValues();
		}
		return defaultValues;
	}

	public void setDefaultValues(DefaultValues paramDefaultValues) {
		defaultValues = paramDefaultValues;
	}

	public JWorksheet getCurrentWorkSheet() {
		return currWorkSheet;
	}

	public void setCurrentWorkSheet(JWorksheet currWorkSheet) {
		this.currWorkSheet = currWorkSheet;
	}

	public void setPaymentId(int paymentId) {
		this.paymentId = paymentId;
	}

	public int getPaymentId() {
		return paymentId;
	}

	public void setGroupLevel(int groupLevel) {
		this.groupLevel = groupLevel;
	}

	public int getGroupLevel() {
		return groupLevel;
	}

	public void setShowLevelList(List<Integer> showLevelList) {
		this.showLevelList = showLevelList;
	}

	public List<Integer> getShowLevelList() {
		return showLevelList;
	}

	public void setUseSelectedObject(boolean useSelectedObject) {
		this.useSelectedObject = useSelectedObject;
	}

	public boolean isUseSelectedObject() {
		return useSelectedObject;
	}

	public void setSelectedObjectId(int selectedObjectId) {
		this.selectedObjectId = selectedObjectId;
	}

	public int getSelectedObjectId() {
		return selectedObjectId;
	}

	/**
	 * 设置薪酬对象类型
	 * 
	 * @param salaryObjectType
	 *            薪酬对象类型
	 */
	public void setSalaryObjectType(SalaryObjectType salaryObjectType) {
		this.salaryObjectType = salaryObjectType;
	}

	/**
	 * 获取薪酬对象类型
	 * 
	 * @return 薪酬对象类型
	 */
	public SalaryObjectType getSalaryObjectType() {
		return salaryObjectType;
	}
}
